package com.example.lenovo.wechattest;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

/**
 * A simple {@link Fragment} subclass.
 */
public class WeChatFragment extends Fragment {

    public List<Sessions> mSessions;

    public WeChatFragment() {
        mSessions = new ArrayList<>();
        mSessions.add(new Sessions(R.mipmap.head1, "小可爱1"));
        mSessions.add(new Sessions(R.mipmap.head2, "小可爱2"));
        mSessions.add(new Sessions(R.mipmap.head3, "小可爱3"));


    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_wechat, container, false);
    }


    public void onActivityCreate(@Nullable Bundle savedInstanceState){
        super.onActivityCreated(savedInstanceState);
        RecyclerView rlvSessions = getActivity().findViewById(R.id.rlv_wechat_sessions);
        rlvSessions.setLayoutManager(new LinearLayoutManager(getContext()));
        SessionAdapter adapter = new SessionAdapter(mSessions);
        rlvSessions.setAdapter(adapter);
    }

}
